package hjt.com.module.user.fragment;


import android.os.Bundle;
import androidx.fragment.app.Fragment;

import android.view.View;
import android.widget.TextView;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.tong.lib.base.BaseFragment;
import com.tong.lib.utils.SPUtils;

import butterknife.BindView;
import hjt.com.componentbase.constant.ARouterConstants;
import hjt.com.module.user.R;
import hjt.com.module.user.R2;


/**
 * A simple {@link Fragment} subclass.
 */
@Route(path = ARouterConstants.FRAGMENT_USER_USER)
public class UserFragment extends BaseFragment {


    @BindView(R2.id.tv)
    TextView tv;

    public UserFragment() {
        // Required empty public constructor
    }

    @Override
    protected int getLayoutResID() {
        return R.layout.user_fragment_user;
    }

    @Override
    protected void init(Bundle savedInstanceState) {
        tv.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                SPUtils.put("isLogin",true);
                SPUtils.put("token","获取到token");
                show("登录成功");
                tv.setText("登录成功");
            }
        });
    }

    @Override
    protected void initEvent() {
    }

    @Override
    public void onHiddenChanged(boolean hidden) {
        super.onHiddenChanged(hidden);
        if (hidden){//相当于调用了onPause();

        }else {//类似于调用了onResume(与onResume区别：第一次创建Fragment的时候没走这个方法)

        }
    }
}
